package cn.edu.sgu.www.mhxysy.controller.qiling;

import cn.edu.sgu.www.mhxysy.consts.CustomConstants;
import cn.edu.sgu.www.mhxysy.consts.CustomMessages;
import cn.edu.sgu.www.mhxysy.consts.MimeTypes;
import cn.edu.sgu.www.mhxysy.entity.qiling.QilingTaozhuangImage;
import cn.edu.sgu.www.mhxysy.restful.JsonResult;
import cn.edu.sgu.www.mhxysy.service.qiling.QilingTaozhuangImageService;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

/**
 * @author 沐雨橙风ιε
 * @version 1.0
 */
@Api(tags = "器灵套装图片管理")
@ApiSupport(author = CustomConstants.AUTHOR)
@Validated
@RestController
@RequestMapping(path = "/qiling_taozhuang_image", produces = MimeTypes.APPLICATION_JSON_CHARSET_UTF_8)
public class QilingTaozhuangImageController {

    private final QilingTaozhuangImageService qilingTaozhuangImageService;

    @Autowired
    public QilingTaozhuangImageController(QilingTaozhuangImageService qilingTaozhuangImageService) {
        this.qilingTaozhuangImageService = qilingTaozhuangImageService;
    }

    @ApiOperation("查询角色的武器器灵效果图片")
    @RequestMapping(value = "/selectImage", method = RequestMethod.GET)
    public JsonResult<QilingTaozhuangImage> selectImage(
            @ApiParam(name = "roleId", value = "角色造型ID", required = true)
            @NotNull(message = "角色造型" + CustomMessages.ID_NOT_NULL) Integer roleId) {
        QilingTaozhuangImage image = qilingTaozhuangImageService.selectImage(roleId);

        return JsonResult.success(null, image);
    }

}